//
//  unittest4.c
//  tests gainCard() function in dominion.c with random inputs
//
//  Created by Preston Skaggs on 1/24/14.
//
//

#include <stdio.h>
#include "dominion.h"
#include "dominion_helpers.h"
#include <stdlib.h>
#include "rngs.h"
#include "math.h"

#define NUM_TESTS 2000

int main(){
    SelectStream(2);
    PlantSeeds(3);
    struct gameState *state = malloc(sizeof(struct gameState));
    int i, n, card, flag, player, test;
    enum CARD first = curse;
    enum CARD last = treasure_map;
    for (n = 0; n < NUM_TESTS; n++) {
        for (i = 0; i < sizeof(struct gameState); i++) {
            ((char*)state)[i] = floor(Random() * 256);
        }
        player = (Random() * 3)+1;
        flag = floor(Random());
        card = (Random()*(last-first))+first;
        test = gainCard(card, state, flag, player);
    }
    
    printf("Test completed");
    return 0;
}